﻿using System;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using KeaoBase;
using System.Reflection;
using KeaoDataBase;

public partial class _Default : System.Web.UI.Page 
{
    private BaseDataBase m_DB;

    protected void Page_Load(object sender, EventArgs e)
    {
        string bangDanHao = Request.QueryString["b"];
        string keHuBianHao = Request.QueryString["u"];
        string zhanDian = Request.QueryString["l"];
        string bangFang = Request.QueryString["f"];
        if (string.IsNullOrEmpty(bangDanHao) || string.IsNullOrEmpty(keHuBianHao) || string.IsNullOrEmpty(zhanDian))
        {
            div_info.Visible = false;
            div_null.Visible = true;
        }
        else
        {
            try
            {
                m_DB = new KeaoSqlServer();
                if (!m_DB.InitDataBase(ConfigurationManager.ConnectionStrings[keHuBianHao].ConnectionString))
                {
                    return;
                }
                else
                {
                    string createCondition = m_DB.CreateAndCondition("chengzhongbianhao", DataValueCommonType.字符串, bangDanHao, "", SearchConditionType.等于);
                    createCondition += m_DB.CreateAndCondition("kehubianhao", DataValueCommonType.字符串, keHuBianHao, "", SearchConditionType.等于);
                    createCondition += m_DB.CreateAndCondition("zhandian", DataValueCommonType.字符串, zhanDian, "", SearchConditionType.等于);
                    if (!string.IsNullOrEmpty(bangFang))
                    {
                        createCondition += m_DB.CreateAndCondition("bangfang", DataValueCommonType.字符串, bangFang, "", SearchConditionType.等于);
                    }
                    DataTable Dt = m_DB.GetDataTableByCondition("tbl_chengzhong", createCondition);
                    if (Dt == null || Dt.Rows.Count == 0)
                    {
                        div_info.Visible = false;
                        div_null.Visible = true;
                    }
                    else
                    {
                        lb_bianhao.Text = string.Format("{0}", Dt.Rows[0]["chengzhongbianhao"]);
                        lb_chepaihao.Text = string.Format("{0}", Dt.Rows[0]["chepaihao"]);
                        lb_danweimingcheng.Text = string.Format("{0}", Dt.Rows[0]["danweimingcheng"]);
                        lb_wuliao.Text = string.Format("{0}", Dt.Rows[0]["wuliaomingcheng"]);
                        lb_xinghao.Text = string.Format("{0}", Dt.Rows[0]["xinghao"]);
                        lb_maozhong.Text = string.Format("{0}", Dt.Rows[0]["maozhong"]);
                        lb_pizhong.Text = string.Format("{0}", Dt.Rows[0]["pizhong"]);
                        lb_kouzhong.Text = string.Format("{0}", Dt.Rows[0]["kouzhong"]);
                        lb_jingzhong.Text = string.Format("{0}", Dt.Rows[0]["jingzhong"]);
                        lb_maozhongshijian.Text = string.Format("{0}", Dt.Rows[0]["maozhongshijian"]);
                        lb_pizhongshijian.Text = string.Format("{0}", Dt.Rows[0]["pizhongshijian"]);
                        lb_maozhongcaozuo.Text = string.Format("{0}", Dt.Rows[0]["maozhongrenyuan"]);
                        lb_zhandian.Text = string.Format("{0}", Dt.Rows[0]["zhandian"]);
                        lb_bangfang.Text = string.Format("{0}", Dt.Rows[0]["bangfang"]);
                    }
                }
            }
            catch
            {
                div_info.Visible = false;
                div_null.Visible = true;
            }
        }
    }
}
